﻿using L7_Modularity.ModuleB.Views;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Navigation.Regions;

namespace L7_Modularity.ModuleB;

[Module(ModuleName = "ModuleBModule", OnDemand = true)]
[ModuleDependency("ModuleCModule")]
public class ModuleBModule : IModule
{
    public void RegisterTypes(IContainerRegistry containerRegistry)
    {
        containerRegistry.RegisterForNavigation<ModuleBMainView>();
    }

    public void OnInitialized(IContainerProvider containerProvider)
    {
        IRegionManager regionManager = containerProvider.Resolve<IRegionManager>();

        regionManager.RegisterViewWithRegion("ContentRegion", "ModuleBMainView"); // 将自己添加到主程序
        regionManager.RegisterViewWithRegion("ModuleBMainContentRegion", "ModuleCMainView"); // 为自己添加内容
    }
}